package com.inossem.warehousestorage_inossem.request.inStorage;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageAllocatingGetListRequestBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageAllocatingListBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

/**
 * 作者：wsy on 2017/12/1 17:26
 * <p>
 * 邮箱：445979770@qq.com
 */

public class InStorageAllocatingListRequest extends Request {

    private static final String CONDITION = "condition";//查询条件

    public static String request(Context context, InStorageAllocatingGetListRequestBean bean, GsonBeanListener gsonBeanListener) {
        String tag;
//        Map<String, String> params = new HashMap<>();
//        params.put(CONDITION, TextUtils.isEmpty(condition) ? "" : condition);
        String url = RequestManage.getUrl(context, RequestConstant.URL_IN_STORAGE_ALLOCATING_LIST );
        Gson gson = new Gson();
        String params = gson.toJson(bean, bean.getClass());
        tag = RequestManage.getHttpsPostWithLoading(context, url,params, new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                InStorageAllocatingListBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), InStorageAllocatingListBean.class);
                excuteJsonBeanNew(context, bean, gsonBeanListener);
            }
        });
        return tag;
    }
}
